package com.hxm.appGenealogy.Function;

import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.hxm.appGenealogy.config.queryVo.QueryWrapperVO;
import com.hxm.appGenealogy.entity.PeopleService;
import com.hxm.appGenealogy.mapper.PeopleServiceMapper;
import jdk.nashorn.internal.runtime.JSONFunctions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * 儿子实体类;
 */
@Component
public class PeopleFunctionService {

    @Autowired
    private PeopleServiceMapper peopleServiceMapper;

    //添加;
    public PeopleService insertPeople(PeopleService peopleService){
        peopleServiceMapper.insert(peopleService);
        return peopleService;
    }
    //修改;
    public PeopleService updateByid(PeopleService peopleService){
        peopleServiceMapper.updateById(peopleService);
        return peopleService;
    }
    //根据id删除;
    public void  delectByid(Long id){
        peopleServiceMapper.deleteById(id);
    }
    //根据条件进行查询;
    public List<PeopleService> slectStringLamQuery(String lanQuery){
        QueryWrapper<PeopleService> queryWrapper = QueryWrapperVO.getQueryWrapper(lanQuery);
        List<PeopleService> peopleServices = peopleServiceMapper.selectList(queryWrapper);
        return peopleServices;
    }
    //跟据条件查询单个;
    public PeopleService getQueryOne(String lanQuery){
        QueryWrapper<PeopleService> queryWrapper = QueryWrapperVO.getQueryWrapper(lanQuery);
        PeopleService peopleServices = peopleServiceMapper.selectOne(queryWrapper);
        return peopleServices;
    }

}
